package com.mozai.shopping.controller;

import com.mozai.shopping.pojo.base.BaseResponse;
import com.mozai.shopping.pojo.http.UserReq;
import com.mozai.shopping.service.UserService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 登录
     * @param request
     * @param response
     * @param userReq
     * @return
     */
    @PostMapping ("/login")
    public BaseResponse login(HttpServletRequest request, HttpServletResponse response,
                              @Valid @RequestBody UserReq userReq){
        return userService.login(request,response,userReq);
    }
}
